<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:vti="http://java.sun.com/jsf/composite/components/vti">
    <h:form id="formPesquisaLeilao" prependId="false">
        <h:panelGrid>
            <vti:inputText id="pesqNome" label="#{msgs['campo.id']}" valid="false"
                            maxlength="40" size="51" value="#{leilaoBean.entidadePesquisa['id']}" />
        </h:panelGrid>
        <h:panelGrid columns="2" styleClass="barraBotoes">
            <p:commandButton action="#{leilaoBean.listar}"
                             label="#{msgs['acao.pesquisar']}"
                             value="#{msgs['acao.pesquisar']}"
                             title="#{msgs['acao.pesquisar']}"
                             process="#{jsfManager.getRealName('pesqNome_text')},@this"
                             update="#{jsfManager.getRealName('tableLeilao_datatable')},#{messages}" />
            <p:commandButton actionListener="#{leilaoBean['resetPesquisa']}"
                             label="#{msgs['acao.limpar']}"
                             value="#{msgs['acao.limpar']}"
                             title="#{msgs['acao.limpar']}"
                             process="@this" update="@form,#{messages}" />
        </h:panelGrid>
        <vti:dataTable id="tableLeilao" styleClass="tableList"
                        value="#{leilaoBean.listaEntidade}"
                        selection="#{selection}" update="#{onselectUpdate}"
                        onselectComplete="#{onselectComplete}">
            <p:column sortBy="#{item.id}"
                      headerText="#{msgs['campo.id']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.id}" />
            </p:column>
            <p:column sortBy="#{item.produtoFk.nome}"
                      headerText="#{msgs['campo.produto']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.produtoFk.nome}" />
            </p:column>
            <p:column sortBy="#{item.vlrLanceMin}"
                      headerText="#{msgs['campo.vlrLanceMin']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.vlrLanceMin}" converter="textConverter">
                    <f:attribute name="type" value="moeda" />
                </h:outputText>
            </p:column>
            <p:column sortBy="#{item.vlrIncLance}"
                      headerText="#{msgs['campo.vlrInc']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.vlrIncLance}" converter="textConverter">
                    <f:attribute name="type" value="moeda" />
                </h:outputText>
            </p:column>
            <p:column sortBy="#{item.dataInicio}"
                      headerText="#{msgs['campo.horaIni']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.dataInicio}" >
                	<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
                </h:outputText>
            </p:column>
            <p:column sortBy="#{item.tempoDuracao}"
                      headerText="#{msgs['campo.tempoDuracao']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.tempoDuracao}" />
            </p:column>
            <p:column sortBy="#{item.qtdMaxProduto}"
                      headerText="#{msgs['campo.qtdMax']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.qtdMaxProduto}" />
            </p:column>
            <p:column styleClass="columnDelete" rendered="#{showDelete}"
                      headerText="#{msgs['acao.excluir']}">
                <p:commandLink oncomplete="dlgLeilaoDelete_widvar.show();">
                    <h:graphicImage library="images" name="del.png" width="15"
                                    alt="#{msgs['acao.excluir']}" title="#{msgs['acao.excluir']}" />
                    <f:setPropertyActionListener target="#{leilaoBean.entidade}" value="#{item}" />
                </p:commandLink>
            </p:column>
            <p:column styleClass="columnDelete" headerText="#{msgs['campo.lance']}">
                <p:commandLink onclick="document.location.href='#{request.contextPath}/pages/lance.jsf?id=#{item.id}'">
                    <h:graphicImage library="images" name="search.png" width="15"
                                    alt="#{msgs['campo.lance']}" title="#{msgs['campo.lance']}" />
                </p:commandLink>
            </p:column>
        </vti:dataTable>
    </h:form>
    <vti:dialogDelete id="dlgLeilaoDelete" actionRemover="#{leilaoBean.remover()}"
                       update="#{jsfManager.getRealName('tableLeilao_datatable')},#{messages}"/>
</ui:composition>